#include <stdio.h>
int main()
{
	float x,y;
	scanf("%f",&x);
	if(x<0) y=-2;
	else if(x>2) y=2*x;
	else y=3*x-2;
	printf("y=%f",y);
	return 0;
 } 
